|
|
|
|
|
|
|
Passing SQL Statements to Other Database Engines |
|
|
|
|
|
|
|
|
Visual Basic has the capability of passing a SQL statement through to an ODBC database server such as SQL Server. When you pass a statement through, the Jet engine does not try to do any processing of the query, but it sends the query to the server to be processed. Remember, however, that the SQL statement must conform to the SQL syntax of the host database. |
|
|
|
|
|
|
|
|
To use the pass-through capability, set the options parameter in the OpenRecordset or the execute methods to the value of the dbSQLPassThrough constant. |
|
|
|
|
|
|
|
|
The project file, SQLDEMO.VBP, available from the Que Web site, contains many of the listings used in this chapter. Each listing is assigned to a command button. Choosing the command button creates a dynaset by using the SQL statement in the listing; the results are displayed in a data-bound grid. The form containing the grid also has a text box that shows the SQL statement. Download the file from www.mcp.com/info. |
|
|
|
|
|
|
|
|
This chapter has taught you the basics of using SQL in your database program. You have seen how to select records and how to limit the selection using the WHERE clause. You have also seen how SQL statements can be used to modify the structure of a database and how to use aggregate functions to obtain summary information. |
|
|
|
|
|